import { addNameSpace } from './util'

const NAME_SPACE = 'SEND_RECORD'

const addPrefix = addNameSpace(NAME_SPACE)

// 设置批次编号
export const SET_BATCH_ID = addPrefix('SET_BATCH_ID')

// 设置消息编号
export const SET_MESSAGE_ID = addPrefix('SET_MESSAGE_ID')

// 设置手机号
export const SET_PHONE = addPrefix('SET_PHONE')

// 设置运营商
export const SET_OPERATOR = addPrefix('SET_OPERATOR')

// 设置状态
export const SET_STATUS = addPrefix('SET_STATUS')

// 设置开始时间
export const SET_START_TIME = addPrefix('SET_START_TIME')

// 设置结束时间
export const SET_END_TIME = addPrefix('SET_END_TIME')

// 获取数据
export const GET_DATA = addPrefix('GET_DATA')

// 获取数据成功
export const GET_DATA_SUCCESS = addPrefix('GET_DATA_SUCCESS')

// 获取数据失败
export const GET_DATA_FAIL = addPrefix('GET_DATA_FAIL')

// 设置page num
export const SET_PAGE_NUM = addPrefix('SET_PAGE_NUM')

export const setBatchId = (batchId) => ({ type: SET_BATCH_ID, batchId })

export const setMessageId = (messageId) => ({ type: SET_MESSAGE_ID, messageId })

export const setPhone = (phone) => ({ type: SET_PHONE, phone })

export const setOperator = (operator) => ({ type: SET_OPERATOR, operator })

export const setStatus = (status) => ({ type: SET_STATUS, status })

export const setStartTime = (startTime) => ({ type: SET_START_TIME, startTime })

export const setEndTime = (endTime) => ({ type: SET_END_TIME, endTime })

export const getData = () => ({ type: GET_DATA })

export const getDataSuccess = (data) => ({ type: GET_DATA_SUCCESS, data })

export const getDataFail = () => ({ type: GET_DATA_FAIL })

export const setPageNum = (pageNum) => ({ type: SET_PAGE_NUM, pageNum })

export default {
  setBatchId,
  setMessageId,
  setPhone,
  setOperator,
  setStatus,
  setStartTime,
  setEndTime,
  getData,
  getDataSuccess,
  getDataFail,
  setPageNum,
}